<template>
    <div class="bao">
        <div class="bj">
            <div class="ing">
                <span :class="{ active: currrentindex == index }" @click="currrentindex == index" v-for="(item,index) in ingarr"
                    :key="index">{{ item }}</span>
            </div>
        </div>
        <div class="list">
            <div class="shop" v-for="(item, index) in shoplist" :key="index">
                <div class="pic">
                    <img :src="item.picture" alt="">
                </div>
                <div class="text">
                    <div class="name">{{ item.name }}</div>
                    <div class="month">
                        <span class="price">{{ item.min_price }}</span>
                        <span class="price">月售{{ item.month_saled }}</span>
                    </div>
                    <div class="info">{{ promotion_info }}</div>
                </div>
            </div>
        </div>
        <div>
            <!-- <router-link to="/Bao/ing">正在上新</router-link>
        <router-link to="/Bao/news">正在抢购</router-link>
        <router-view></router-view> -->
        </div>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    data() {
        return {
            ingarr: ['正在抢购', '上新预告'],
            currrentindex: 0,
            shoplist: []
        }
    },
    mounted() {
        axios.get('/api/tuan/list', {
            params: {
                status: this.currrentindex
            }
        }).then((res) => {
            this.shoplist = res.data;
            this.shoplist = res.data.list;
            console.log(res.data.list);
        })
    },
    // beforeUpdate() {
    //     axios
    //         .get('/api/tuan/list', {
    //             params: {
    //                 status: this.currrentindex
    //             }
            
    //         }).then((res) => {
    //             this.ingarr = res.data.list;
    //     })
    // },
    // methods: {
        
    // }
}
</script>

<style lang="scss" scoped >
.bj {
    background: red;
    height: 200px;
    // line-height: 300px;
    // text-align: center;
}

.ing {
    box-sizing: border-box;
    padding-left: 10px;
    position: relative;
    top: 180px;
    width: 100%;
    height: 20px;
    // background: blueviolet;
}

.ing span {
    padding-right: 50px;
    // background: skyblue;
    color: white;
}

.list .shop {
    display: flex;
    margin: 10px;
}

.imgbox {
    background: red;
    width: 80px;
    height: 80px;
    margin-right: 10px;
}

.imgbox img {
    width: 100%;
    height: 100%;

}

.list .shop {
    display: flex;

}

.pic {
    width: 100px;
    height: 100px;
}

.pic img {
    width: 100px;
    height: 100px;
}

.text {
    margin-left: 10px;
    margin-top: 10px;
}

.active {
    color: black;
}
</style>